<?php

class Users_Form_Usertypeupdate extends Zend_Form {

    public function init() {
        $this->mainForm($array = null);
    }

    public function mainForm($result) {
        $this->setAction('/admin/usertype/update')
                ->setMethod('post');

        //setting values
        $type = $result[0]['type'];
        $id = $result[0]['sr'];

        //text
        $userType = new Zend_Form_Element_Text('type');
        $userType->setLabel("User Type: ")
                ->setValue($type)
                ->setOptions(array('size' => '30'))
                ->setRequired(true)
                ->addValidator('Alnum')
                ->addFilter('htmlEntities')
                ->addFilter('stringTrim');

        $userTypeId = new Zend_Form_Element_Hidden('sr');
        $userTypeId->setValue($id);
        //submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Update User Type')
                ->setOptions(array('class' => 'submit'))
                ->setAttrib('class', 'btn btn-success');

        //attach to form
        $this->addElement($userType)
                ->addElement($userTypeId)
                ->addElement($submit);
    }

}

